home *** CD-ROM | disk | FTP | other *** search
/ Knitting Made Easy / Knitting.iso / App / Patterns.dxr / behaviors_19_Click NoVideo.ls < prev    next >
Encoding:
Text File  |  2002-04-18  |  2.4 KB  |  70 lines

  1. property Action, WhichLabel, standardImage, alternateImage
  2.  
  3. on mouseDown
  4.   emem = the memberNum of sprite clickOn()
  5.   set the memberNum of sprite clickOn() to emem + 1
  6.   updateStage()
  7.   repeat while the stillDown
  8.     if rollover(clickOn()) then
  9.       set the memberNum of sprite clickOn() to emem + 1
  10.     else
  11.       set the memberNum of sprite clickOn() to emem - 1
  12.     end if
  13.     updateStage()
  14.   end repeat
  15.   updateStage()
  16.   set the memberNum of sprite clickOn() to emem
  17.   updateStage()
  18.   if Action = "Go to marker" then
  19.     go(WhichLabel)
  20.   else
  21.     if Action = "Play marker" then
  22.       play frame WhichLabel
  23.     end if
  24.   end if
  25. end
  26.  
  27. on beginSprite me
  28.   me.standardImage = the member of sprite me.spriteNum
  29.   memref = the member of sprite the currentSpriteNum
  30.   castLibNum = memref.castLibNum
  31.   alternateImage = member(memref.memberNum + 1, castLibNum)
  32. end
  33.  
  34. on mouseWithin me
  35.   set the member of sprite the spriteNum of me to me.alternateImage
  36. end
  37.  
  38. on mouseEnter me
  39.   set the member of sprite the spriteNum of me to me.alternateImage
  40. end
  41.  
  42. on mouseLeave me
  43.   if the mouseUp then
  44.     set the member of sprite the spriteNum of me to me.standardImage
  45.   end if
  46. end
  47.  
  48. on getPropertyDescriptionList
  49.   global ibcDefaultParams
  50.   if the currentSpriteNum = 0 then
  51.     memdefault = 0
  52.   else
  53.     memref = the member of sprite the currentSpriteNum
  54.     castLibNum = memref.castLibNum
  55.     memdefault = member(memref.memberNum + 1, castLibNum)
  56.   end if
  57.   if listp(ibcDefaultParams) then
  58.     return ibcDefaultParams
  59.   else
  60.     description = [:]
  61.     addProp(description, #Action, [#default: "None", #range: ["None", "Go to marker", "Play marker"], #format: #symbol, #comment: "MouseUp Action:"])
  62.     addProp(description, #WhichLabel, [#comment: "Destination Marker:", #format: #marker, #default: "next"])
  63.     return description
  64.   end if
  65. end
  66.  
  67. on getBehaviorDescription
  68.   return "- Click Behavior -" & RETURN & "Defined: controls a dual-image button." & RETURN & "Intended Use: to give user a simple audio + visual feedback that they've engaged a control. Rolling off button during mouseDown will disengage." & RETURN & RETURN & "- Properties -" & RETURN & "MouseUp Action: assigns a button course of action." & RETURN & "  (Note: Select 'None' if you plan to add a seperate mouseUp behavior to this button)" & RETURN & "Destination Marker: assigns a destination to the course of action." & RETURN & RETURN & "(Explore the 'LookHere' folder on the CD-Rom for examples of each behavior)"
  69. end
  70.